home *** CD-ROM | disk | FTP | other *** search
/ Kentucky Virtual Art Museum / Kentucky Virtual Art Museum.iso / site / museums / zoomify / othello.swf / scripts / ZoomifyToolbarSymbol.as next >
Text File  |  2005-06-10  |  3KB  |  102 lines

  1. function ZoomifyToolbar()
  2. {
  3.    this.gSliderIsDown = false;
  4.    this.gSliderY = 0;
  5.    callbackName = targetPath(this) + ".viewChangedCallback";
  6.    this.getImageInstance().registerCallback("View",callbackName);
  7.    this.update();
  8. }
  9. ZoomifyToolbar.prototype = new MovieClip();
  10. Object.registerClass("ZoomifyToolbarSymbol",ZoomifyToolbar);
  11. ZoomifyToolbar.prototype.viewChangedCallback = function(instance, x, y, zoom)
  12. {
  13.    this.adjustSlider();
  14. };
  15. ZoomifyToolbar.prototype.update = function()
  16. {
  17.    this.ZoomSlider_mc._visible = this._showSlider;
  18. };
  19. ZoomifyToolbar.prototype.setSliderVisibility = function(sliderVisibility)
  20. {
  21.    this._showSlider = sliderVisibility;
  22.    this.update();
  23. };
  24. ZoomifyToolbar.prototype.adjustSlider = function()
  25. {
  26.    if(this.gSliderY == 0)
  27.    {
  28.       this.gSliderY = this.ZoomSlider_mc._y;
  29.    }
  30.    var _loc5_ = this.getImageInstance().getZoom();
  31.    var _loc2_ = this.getImageInstance()._minZoom;
  32.    var _loc3_ = this.getImageInstance()._maxZoom;
  33.    if(_loc3_ == -1)
  34.    {
  35.       _loc3_ = this.getImageInstance().calculateScreenZoom();
  36.    }
  37.    if(_loc2_ == -1)
  38.    {
  39.       _loc2_ = this.getImageInstance().calculateScreenZoom();
  40.    }
  41.    var _loc4_ = this.background_mc._width;
  42.    this.ZoomSlider_mc._x = (- _loc4_) / 2 + _loc4_ * ((_loc5_ - _loc2_) / (_loc3_ - _loc2_));
  43.    this.ZoomSlider_mc._y = this.gSliderY;
  44. };
  45. ZoomifyToolbar.prototype.sliderDragged = function()
  46. {
  47.    if(this.gSliderIsDown == true)
  48.    {
  49.       if(this.gSliderY == 0)
  50.       {
  51.          this.gSliderY = this.ZoomSlider_mc._y;
  52.       }
  53.       var _loc7_ = this.getImageInstance().getZoom();
  54.       var _loc3_ = this.getImageInstance()._minZoom;
  55.       var _loc4_ = this.getImageInstance()._maxZoom;
  56.       if(_loc4_ == -1)
  57.       {
  58.          _loc4_ = this.getImageInstance().calculateScreenZoom();
  59.       }
  60.       if(_loc3_ == -1)
  61.       {
  62.          _loc3_ = this.getImageInstance().calculateScreenZoom();
  63.       }
  64.       var _loc2_ = this.background_mc._width;
  65.       if(this.ZoomSlider_mc._x > _loc2_ / 2)
  66.       {
  67.          this.ZoomSlider_mc._x = _loc2_ / 2;
  68.       }
  69.       if(this.ZoomSlider_mc._x < (- _loc2_) / 2)
  70.       {
  71.          this.ZoomSlider_mc._x = (- _loc2_) / 2;
  72.       }
  73.       var _loc5_ = this.ZoomSlider_mc._x;
  74.       var _loc6_ = _loc3_ + (_loc4_ - _loc3_) * ((_loc5_ + _loc2_ / 2) / _loc2_);
  75.       this.ZoomSlider_mc._y = this.gSliderY;
  76.       this.getImageInstance().setZoom(_loc6_);
  77.    }
  78. };
  79. ZoomifyToolbar.prototype.getImageInstance = function()
  80. {
  81.    var imageInstance = null;
  82.    if(this._targetZoomifyViewer.substring(0,5) == "_root" || this._targetZoomifyViewer.substring(0,6) == "_level")
  83.    {
  84.       imageInstance = eval(this._targetZoomifyViewer);
  85.    }
  86.    else
  87.    {
  88.       imageInstance = this._parent[this._targetZoomifyViewer];
  89.    }
  90.    return imageInstance;
  91. };
  92. ZoomifyToolbar.prototype.sliderReleased = function()
  93. {
  94.    this.sliderDragged();
  95.    this.gSliderIsDown = false;
  96.    this.getImageInstance().updateView();
  97. };
  98. ZoomifyToolbar.prototype.sliderPressed = function()
  99. {
  100.    this.gSliderIsDown = true;
  101. };
  102.